import request from '@/utils/request'

//加载未完成验收记录通过编号
export function selectByAccId(acceptId) {
  return request({
    url: '/TakeMaterial/requisition-header/selectByAccId',
    method: 'get',
    params:{
      acceptId: acceptId
    }
  })
}

export function AddPurchase(department, provider, invoice, accept_id) {
  return request({
    url: '/TakeMaterial/requisition-header/AddPurchase',
    method: 'post',
    data: {
      department: department,
      provider: provider,
      accept_id: accept_id,
      invoice: invoice
    }
  })
}

export function selectAll(department) {
  return request({
    url: '/TakeMaterial/requisition-header/selectAll',
    method: 'get',
    params: {
      department: department
    }
  })
}

export function selectByOK() {
  return request({
    url: '/entryWarehouse/accept-inform/selectByOk',
    method: 'get'
  })
}

export function selectByYes(status) {
  return request({
    url: '/entryWarehouse/accept-inform/selectByStatus',
    method: 'get',
    params: {
      status: status
    }
  })
}

export function selectByNot() {
  return request({
    url: '/TakeMaterial/requisition-header/selectByNot',
    method: 'get'
  })
}
//删除申请信息
export function RemoveAdmin(id) {
  return request({
    url: '/TakeMaterial/requisition-header/RemoveAdmin',
    method: 'post',
    params: {
      id: id
    }
  })
}
export function Select(department, provider) {
  return request({
    url: '/TakeMaterial/material-requisition/Select',
    method: 'get',
    params: {
      department: department,
      provider: provider
    }
  })
}
// 查询用户所属部门信息
export function selAccountDepart(name) {
  return request({
    url: '/materialPurchase/material-purchase/selAccount',
    method: 'post',
    params: {
      account: name
    }
  })
}
export function editStatus(id, provider, acceptId, department, requisitionId, principal, sender,
  receiver, status, departLeader, companyLeader) {
  return request({
    url: '/TakeMaterial/requisition-header/editStatus',
    method: 'post',
    data: {
      id: id,
      provider: provider,
      acceptId: acceptId,
      department: department,
      requisitionId: requisitionId,
      principal: principal,
      sender: sender,
      receiver: receiver,
      status: status,
      departLeader: departLeader,
      companyLeader: companyLeader
    }
  })
}
